<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInLeft ibox-content">
        <form class="form-horizontal m"   enctype="multipart/form-data"  id="exportFrm"     method="post"  th:action="@{/dailymenu/everyday/doImport}">
			<div class="form-group">	
				<label class="col-sm-12 ">导入<b th:text="${year}" />年第<b th:text="${yearOfweek}" />周的<b th:text="${dinerType}" />
					(<b th:text="${begin}" />至<b th:text="${end}" />)

				</label><br/>
				<label class="col-sm-12 ">1.请务必按照格式，否则导入失败</label><br/>
				<label class="col-sm-12 ">2.若本周有排餐，将自动覆盖，请务必谨慎操作！</label><br/>
				<label>
					<a class="btn  btn-success btn-rounded"   th:href="${excelDownUrl}" ><i class="fa fa-plus"></i> 下载模板</a></label>
				<br/>
			</div>
			<div class="form-group">
				<div style="width: 770px;height: 200px; border: solid #c1c1c1 1px ">

					<label class="col-sm-12 " style="padding-top:50px; padding-left: 300px;">
						<img  th:src="@{/img/import.png}" alt="png"><br/>

						请将文件拖到此处，或点击<a href="#"   ><input type="file" id="file" name="file"/></a> </label>
				</div>

            </div>
			<div class="form-group" style="line-height: 30px">


				<input type="checkbox" style="height: 20px;width: 30px"   name="replaceIt"  id="replaceIt" ><label >若菜品类目或者菜品不存在，则自动添加</label>


	           </div>
			<div class="form-group">

				<div class="form-control-static col-sm-offset-9">
					<button onclick="$.modal.close()" class="btn " type="button">关闭</button>
					<button type="button" onclick="doImport()"   class="btn btn-primary">开始导入</button>
				</div>
			</div>
            <input  type="hidden"  id="begin"  th:value="${begin}"/>
            <input  type="hidden"  id="end" th:value="${end}" />
            <input  type="hidden"  id="dinerType" th:value="${index}"  />

        </form>

	</div>
    <div th:include="include::footer"></div>
    <script th:src="@{/ajax/libs/select/select2.js}"></script>
    <script type="text/javascript">

        function doImport() {
         // if( confirm("你确认要开始导入？"))
          {
              var v= document.getElementById("replaceIt").checked;
              var exportObj=document.getElementById("exportFrm");
              var beginObj=document.getElementById("begin");
              var endObj=document.getElementById("end");
              var dinerTypeObj=document.getElementById("dinerType");
              var  rit=0;
              if(v ) {
                  rit=1;
              }
              var url=exportObj.action;

              url=url+"?&replaceIt="+rit+"&begin="+beginObj.value +"&end="+endObj.value+"&dinnerType="+dinerTypeObj.value ;
              exportObj.action=url;

			  $.modal.confirm("您确认要开始导入？", function() {
				  exportObj.submit();
				  return true;
			  });


          }
          return false;
        }

	</script>
</body>
</html>
